/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 11951
 * Date: 2025-03-06
 * Time: 19:40
 */
/*
* 算术运算符
* */
public class Test {
    public static void main1(String[] args) {
        int a = 20;
        int b = 10;
        System.out.println(a + b);
        System.out.println(a - b);
        System.out.println(a * b);
        System.out.println(a / b);

        System.out.println(11.5 / 2.0);
        System.out.println(11.5 % 2.0);
    }

    /*
    * 增量运算符
    * */
    public static void main2(String[] args) {
        int a=1;
        a+=2;
        System.out.println(a);//3
        a-=1;
        System.out.println(a);//2
        a*=2;
        System.out.println(a);//4
        a/=3;
        System.out.println(a);//1
        int b=5;
        b++;
        System.out.println(b);
        ++b;
        System.out.println(b);
    }

    /*
    * 关系运算符
    * */
    public static void main3(String[] args) {
        int a =10;
        int b =20;
        System.out.println(a > b);
        System.out.println(a < b);
        System.out.println(a == b);
        System.out.println(a != b);
        System.out.println(a <= b);
        System.out.println(a >= b);
    }
    /*
    * 逻辑运算符
    * */
    public static void main4(String[] args) {
        int a=1;
        int b=2;
        System.out.println(a == 1 && b == 2);//有假则假
        System.out.println(a == 1 && b < 1);
        int  c=5;
        int d=6;
        System.out.println(c== 1 || d == 5);//有真则真
        System.out.println(c == 5 || d != 6);
        int f=6;
        System.out.println(a == 1);
        System.out.println(!(a == 1));
    }

    /*
    * 位运算符
    * */
    public static void main5(String[] args) {
        int a=10;
        int b=20;
        System.out.println(a & b);
        int a1=10;
        int b1=20;
        System.out.println(a1 | b1);
    }

    /*>
    * 条件运算符
    * */
    public static void main(String[] args) {
        int a=10;
        int b=20;
        int max=a>b?a:b;
        System.out.println(max);//20

        int c=9;
        int d=5;
        int e =c>d?1:0;
        System.out.println(e);

        int a1=10;
        int b1=30;
        int c1=a1+((b1-a1)>>1);
        System.out.println(c1);
    }
}